Optimal. Leaf size=31 \[ -\frac {1}{2 x}+\frac {\cos \left (a+\frac {b}{x}\right ) \sin \left (a+\frac {b}{x}\right )}{2 b} \]
[Out]
________________________________________________________________________________________
Rubi [A]
time = 0.02, antiderivative size = 31, normalized size of antiderivative = 1.00, number of steps
used = 3, number of rules used = 3, integrand size = 14, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.214, Rules used = {3460, 2715, 8}
\begin {gather*} \frac {\sin \left (a+\frac {b}{x}\right ) \cos \left (a+\frac {b}{x}\right )}{2 b}-\frac {1}{2 x} \end {gather*}
Antiderivative was successfully verified.
[In]
[Out]
Rule 8
Rule 2715
Rule 3460
Rubi steps
\begin {align*} \int \frac {\sin ^2\left (a+\frac {b}{x}\right )}{x^2} \, dx &=-\text {Subst}\left (\int \sin ^2(a+b x) \, dx,x,\frac {1}{x}\right )\\ &=\frac {\cos \left (a+\frac {b}{x}\right ) \sin \left (a+\frac {b}{x}\right )}{2 b}-\frac {1}{2} \text {Subst}\left (\int 1 \, dx,x,\frac {1}{x}\right )\\ &=-\frac {1}{2 x}+\frac {\cos \left (a+\frac {b}{x}\right ) \sin \left (a+\frac {b}{x}\right )}{2 b}\\ \end {align*}
________________________________________________________________________________________
Mathematica [A]
time = 0.04, size = 32, normalized size = 1.03 \begin {gather*} -\frac {a+\frac {b}{x}}{2 b}+\frac {\sin \left (2 \left (a+\frac {b}{x}\right )\right )}{4 b} \end {gather*}
Antiderivative was successfully verified.
[In]
[Out]
________________________________________________________________________________________
Maple [A]
time = 0.04, size = 34, normalized size = 1.10
method | result | size |
risch | \(-\frac {1}{2 x}+\frac {\sin \left (\frac {2 a x +2 b}{x}\right )}{4 b}\) | \(23\) |
derivativedivides | \(-\frac {-\frac {\cos \left (a +\frac {b}{x}\right ) \sin \left (a +\frac {b}{x}\right )}{2}+\frac {a}{2}+\frac {b}{2 x}}{b}\) | \(34\) |
default | \(-\frac {-\frac {\cos \left (a +\frac {b}{x}\right ) \sin \left (a +\frac {b}{x}\right )}{2}+\frac {a}{2}+\frac {b}{2 x}}{b}\) | \(34\) |
norman | \(\frac {-\frac {1}{2}+\frac {x \tan \left (\frac {a}{2}+\frac {b}{2 x}\right )}{b}-\left (\tan ^{2}\left (\frac {a}{2}+\frac {b}{2 x}\right )\right )-\frac {\left (\tan ^{4}\left (\frac {a}{2}+\frac {b}{2 x}\right )\right )}{2}-\frac {x \left (\tan ^{3}\left (\frac {a}{2}+\frac {b}{2 x}\right )\right )}{b}}{\left (1+\tan ^{2}\left (\frac {a}{2}+\frac {b}{2 x}\right )\right )^{2} x}\) | \(89\) |
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Maxima [A]
time = 0.29, size = 25, normalized size = 0.81 \begin {gather*} \frac {x \sin \left (\frac {2 \, {\left (a x + b\right )}}{x}\right ) - 2 \, b}{4 \, b x} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Fricas [A]
time = 0.37, size = 34, normalized size = 1.10 \begin {gather*} \frac {x \cos \left (\frac {a x + b}{x}\right ) \sin \left (\frac {a x + b}{x}\right ) - b}{2 \, b x} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Sympy [B] Leaf count of result is larger than twice the leaf count of optimal. 262 vs.
\(2 (20) = 40\).
time = 1.25, size = 262, normalized size = 8.45 \begin {gather*} \begin {cases} - \frac {b \tan ^{4}{\left (\frac {a}{2} + \frac {b}{2 x} \right )}}{2 b x \tan ^{4}{\left (\frac {a}{2} + \frac {b}{2 x} \right )} + 4 b x \tan ^{2}{\left (\frac {a}{2} + \frac {b}{2 x} \right )} + 2 b x} - \frac {2 b \tan ^{2}{\left (\frac {a}{2} + \frac {b}{2 x} \right )}}{2 b x \tan ^{4}{\left (\frac {a}{2} + \frac {b}{2 x} \right )} + 4 b x \tan ^{2}{\left (\frac {a}{2} + \frac {b}{2 x} \right )} + 2 b x} - \frac {b}{2 b x \tan ^{4}{\left (\frac {a}{2} + \frac {b}{2 x} \right )} + 4 b x \tan ^{2}{\left (\frac {a}{2} + \frac {b}{2 x} \right )} + 2 b x} - \frac {2 x \tan ^{3}{\left (\frac {a}{2} + \frac {b}{2 x} \right )}}{2 b x \tan ^{4}{\left (\frac {a}{2} + \frac {b}{2 x} \right )} + 4 b x \tan ^{2}{\left (\frac {a}{2} + \frac {b}{2 x} \right )} + 2 b x} + \frac {2 x \tan {\left (\frac {a}{2} + \frac {b}{2 x} \right )}}{2 b x \tan ^{4}{\left (\frac {a}{2} + \frac {b}{2 x} \right )} + 4 b x \tan ^{2}{\left (\frac {a}{2} + \frac {b}{2 x} \right )} + 2 b x} & \text {for}\: b \neq 0 \\- \frac {\sin ^{2}{\left (a \right )}}{x} & \text {otherwise} \end {cases} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Giac [A]
time = 6.41, size = 29, normalized size = 0.94 \begin {gather*} -\frac {\frac {2 \, {\left (a x + b\right )}}{x} - \sin \left (\frac {2 \, {\left (a x + b\right )}}{x}\right )}{4 \, b} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Mupad [B]
time = 4.57, size = 22, normalized size = 0.71 \begin {gather*} \frac {\sin \left (2\,a+\frac {2\,b}{x}\right )}{4\,b}-\frac {1}{2\,x} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________